Tx

class Tx(connection: Connection) : Transaction

Represents a transactional context for executing SQL operations with commit and rollback capabilities.

This class implements the Transaction interface and ensures thread safety through the use of a Mutex. It provides methods to manage the lifecycle of a transaction, execute SQL operations, and retrieve result sets.

Parameters

connection

The database connection associated with this transaction.

Constructors

Link copied to clipboard
constructor(connection: Connection)

Initializes the transaction with a given database connection.

Properties

Link copied to clipboard
open override val status: Transaction.Status

Functions

Link copied to clipboard
open suspend override fun commit(): Result<Unit>
Link copied to clipboard
open suspend override fun execute(statement: Statement): Result<Long>
open suspend override fun execute(sql: String): Result<Long>
Link copied to clipboard
open suspend fun <T> fetchAll(sql: String, rowMapper: RowMapper<T>): Result<List<T>>
open suspend override fun fetchAll(statement: Statement): Result<ResultSet>
open suspend override fun fetchAll(sql: String): Result<ResultSet>
open suspend override fun <T> fetchAll(statement: Statement, rowMapper: RowMapper<T>): Result<List<T>>
Link copied to clipboard
open fun isOpenOrError()
Link copied to clipboard
open suspend override fun rollback(): Result<Unit>